$(function(){
	var $menuZd = $(".menu-zd");
	var $mainLeft = $(".main-left");
	var $mainRight = $(".main-right");
	var $contentScroll = $(".content-scroll");
	var $nodeContant = $(".node-contant");
	var $nodeContantScroll = $(".node-contant-scroll");
	var $mainRightScroll = $(".main-right-scroll");
	var $nodeItem = $(".node-item");
	var $modelItem = $(".model-item");
	var $wdItem = $(".wd_item");
	var $menuico = $("#menuico");
	var $menuzd = $(".menu-zd");
	var $sjTatol = $(".sj-tatol");
	var $flowCount = $(".flow-count");
	var $documentIfram = $(".documentIfram");
	var $treeContainer = $(".treeContainer");
	var $monitorPanorama = $(".monitor-panorama");
	
	var initWidows = function() {
		var winWidth = $(window).width();
		var winHeight = $(window).height();
		//界面窗口布局尺寸设置
		$contentScroll.height(winHeight - 88);
		$nodeContant.height(winHeight);
		$nodeContantScroll.height(winHeight);
		//$nodeContant.width(winWidth);
		$mainLeft.height(winHeight);
		$mainRight.height(winHeight);
		$mainRightScroll.height(winHeight);
		//$mainRight.width( winWidth);
		$nodeItem.height(winHeight);
		$modelItem.height(winHeight);
		$wdItem.height(winHeight - 32 );
		$sjTatol.width("auto");
		$sjTatol.height($sjTatol.width()*0.3);
		//$flowCount.width(winWidth*0.423);
		$flowCount.width("auto");
		$flowCount.height($flowCount.width()*0.3);
		$documentIfram.height(winHeight-47);
		$treeContainer.height(winHeight-90);
		$monitorPanorama.width(winWidth*0.31)
		$monitorPanorama.height($monitorPanorama.width()*0.5)
		
	};
	
	initWidows();
	$(window).resize(function() {
		initWidows();
	});
	
	//小图标方向
	$menuico.click(function() {
		if ($(this).hasClass("ico-icodingzi")) {
			$(this).removeClass("ico-icodingzi").addClass("ico-icodingzixia");
		} else {
			$(this).removeClass("ico-icodingzixia").addClass("ico-icodingzi");
		}
	});
	
	//菜单显示隐藏
	$menuzd.click(function() {
		var winWidth = $(window).width();
		var winHeight = $(window).height();
	
		if ($mainLeft.is(":visible")) {
			$mainLeft.hide();
			$mainRight.width(winWidth);
			$nodeContant.width(winWidth - 210);
		} else {
			$mainLeft.show();
			$contentScroll.height(winHeight - 198);
			$nodeContant.width(winWidth - 400);
			$mainRight.width( winWidth - 190);
		}
	});
	
	//选项卡
    var resetTabs = function (index){
        $(".tab-content").eq(index).children("div").hide(); //Hide all content
        $(".tabs").eq(index).children("li").find("a").removeClass("cur"); //Reset id's
    };
    $(".tabs li:first a").addClass("cur"); // Activate first tab
    $(".tabs a").click(function(e){
        e.preventDefault();
        if ($(this).hasClass("cur")){ //detection for current tab
            return;
        }
        else{
            var index=$(".tabs").index($(this).parents("ul"));
            resetTabs(index);
            $(this).addClass("cur"); // Activate this
            var t=".tab-content ."+$(this).attr('name');
            $(t).fadeIn(); // Show content for current tab
        }
    });
    
    showOperationTips();
});

function showOperationTips(){
	//操作提示样式
	$(".icon").bind("mouseover",function(){
		var tipsWidth = $(this).find('span').width();
		var tip_span_width = tipsWidth + 16;
		var left_span = (tip_span_width -27) / 2;
		$(".i-tip").css("left", - left_span );
	})
}
